package com.pshcp.common.enums;

/**
 * @Description: 时间段代码0：全天 1:上午,12:中午, 2:下午, 4:晚上
 * @Author: xiaoche
 * @Date: 2022/10/29 12:36
 */
public enum DayTypeEnum {

    ALL(0, "全天"),

    MORNING(1, "上午"),

    AFTERNOON(2, "下午"),

    MIDDAY(12, "中午"),

    NIGHT(4, "晚上"),

    ;

    private Integer code;
    private String desc;

    DayTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescByCode(int code){
        for(DayTypeEnum e : DayTypeEnum.values()){
            if(e.getCode().intValue() == code){
                return e.getDesc();
            }
        }
        return null;
    }

}
